/*
 * Copyright (c) 2006, 2022, webrx.cn All rights reserved.
 *
 */
package cn.webrx.mapper;

import cn.webrx.entity.Book;
import org.apache.ibatis.annotations.CacheNamespace;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.cache.decorators.FifoCache;

import java.util.List;

/**
 * <p>Project: mybatis2022 - BookMapper
 * <p>Powered by webrx On 2022-04-15 09:39:14
 * <p>Created by IntelliJ IDEA
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
@Mapper @CacheNamespace(eviction = FifoCache.class, flushInterval = 60000, size = 1024, readWrite = true)
public interface BookMapper {
    @Select("select id,name,author,price from book")
    List<Book> queryAll();

    @Select("select * from book where id = #{id}")
    public Book queryById(int id);

    @Update("update book set name=#{name},author=#{author},price=#{price} where id = #{id}")
    public int update(Book book);
}
